package com.itheima.homework;

public class Test3 {
    public static void main(String[] args) {
        int[] arr = {11, 22, 33, 44, 55, 66};
        change(arr, 1, 5);
    }

    public static void change(int[] arr, int a, int b) {
        int c = arr[a];
        System.out.print("{");
        for (int i = 0; i < arr.length; i++) {
            if (i == a) {
                arr[a] = arr[b];
            } else if (i == b) {
                arr[b] = c;
            }
            if (i == arr.length - 1) {
                System.out.print(arr[i] + "}");
            } else {
                System.out.print(arr[i] + ",");
            }
        }
    }

}

